// .txt

beginzonescript;

variables;

short crime_tolerance = 200;
short last_abil;
short i;
short unbound_count = 0;

body;

beginstate INIT_STATE;

	set_name(24,"Augmented Vlish");
	set_level(24,12);
	set_boss_level(24,1);
	
	add_range_to_group(25,28,1);
	set_aggression(1001,9);
	
	//if (get_sdf() > 0) {
		//make_zone_hostile();
		//}

	last_abil = get_current_tick();
	
	set_crime_tolerance(crime_tolerance);
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	if (gf(15,6) == 1) {
		sf(15,6,2);
		inc_flag(25,2,1);
		}

	// clear zone?
	if ((zone_clear(ME) == FALSE) && (get_flag(14,6) > 9)) {
		print_str_color("You have killed enough of the vlish.",2);
		print_str_color("  You can pass this area safely now.",2);
		award_party_xp(100,10);
		clear_zone(ME);	
		}
		
	//if ((get_crime_level() >= crime_tolerance) && (get_sdf(,) == 0)) {
	//	make_zone_hostile();
	//	set_flag(,,1);
	//	}

	// if (gf(,) == 0) {
	//	if (get_ran(1,0,100) < 10)
	//		give_char_text_bubble(,"");
	//	}
	
	if (tick_difference(last_abil,get_current_tick()) > 0) {
		last_abil = get_current_tick();
		
		if (unbound_count < 90) {
			if (is_group())
				unbound_count = unbound_count + 1;
				else unbound_count = unbound_count + 6;
			}
		if ((party_dist_to_nav(3) > 12) && (unbound_count < 100) && (unbound_count >= 50)) {
			
			unbound_count = 100;
			if (gf(15,6) == 0) {
				spawn_creature(22);
				set_aggression(30,8);
				place_particle_num(30,18,12,4);		
				place_particle_num(30,19,12,4);		
				place_particle_num(30,20,12,4);		
				print_str_color("You sense a hostile presence. Something has entered the fen.",3);
				if (gf(15,7) == 0)
					begin_talk_mode(28);
				}
			}
		}

	if ((char_ok(30)) && (dist_to_nav_point(30,4) <= 4)) {
		erase_char(30);
		unbound_count = 0;
		print_str_color("You no longer sense the hostile presence.",2);
		}
		
	// party in ruin?
	sf(15,20,0);
	if (party_dist_to_nav(5) <= 16)
		sf(15,20,1);
	break;

//beginstate 10;
//break;

//	print_str("");
//	set_terrain_string_range(".",3);
//	set_terrain_string_range("The sign says - .",3);
